package com.itheima.dao;


import com.itheima.pojo.Brand;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface BrandsMapper {
    //查询所有
    @Select("select * from tb_brand")
    List<Brand> selectAll();

    //单条件查询
    @Select("select * from tb_brand where id=#{id}")
    Brand selectByid(int id);

    //添加数据
    @Insert("insert into tb_brand values (null,#{brand_name},#{company_name},#{ordered},#{description},#{status})")
    public void addByid(Brand brand);
    //修改
    @Update("update tb_brand set brand_name =#{brand_name} ," +
            "company_name = #{company_name}," +
            "ordered=#{ordered}," +
            "description=#{description}," +
            "status=#{status} where id = #{id}")
    public int updateByid(Brand brand);
    //删除
    @Delete("delete from tb_brand where id = #{id}")
    public int deleteByid(Integer id);
}
